feat(diagnostics): add opt-in span context to error logs - #111
Conversation
|
Addressed in a61fa9f.
The 2 → 3 → 4 markers tracked two unmerged implementation phases, not a necessary compatibility boundary with the shipped format. Restored writer schema 2: the shipped v2 top-level reader ignores the additive Both argument-count suppressions were replaced with named parameter types. This remains a draft preparatory PR; full typed producer/transport integration is still release-gated, so this does not close #48. |
|
Follow-up: 04c7335 also removes the remaining PR-added argument-count suppression in ACP v2 by grouping lifecycle/effects instruments in The entire PR and its follow-up changes have an independent review with no actionable findings at this exact head, and both current-head CI jobs pass. Both user threads are addressed and resolved. The PR remains draft because full typed producer/transport integration is still release-gated. |
|
Reworked in b650191. Independent full-diff and exact-head reviews are clean. Local strict validation and both configured CI jobs passed at this head: https://github.com/speakeasy-api/kit/actions/runs/33993518142. Keeping this draft diagnostic-only. A real Agent→AsyncTaskManager→Tool regression confirms missing invocation ancestry even for foreground tools; Compose/Runlet thread boundaries and remote child spans also remain incomplete. These partial histories do not establish replay safety or fulfill all original #47/#48 acceptance; recovery remains outside this PR. |
Summary
Add opt-in, bounded local tracing span context alongside existing fatal error logs, independently of OpenTelemetry export.
capture_error_spansdefaults tofalse; enabling it attaches an optionalspan_contextfield to schema-v2 records.Impact
Disabled collection installs no diagnostic layer or retained span history. Built-in TUI and
acp.kitchildren inherit the resolved setting and require compatible Kit executables. Existing errors, cancellation handling, and diagnostic-file compatibility are preserved.Technical details
Bounded local span history
Operation spans remain alive through execution and existing error-log writes. Span extensions retain approved structured fields from active and already-closed children, capped at 24 fragments, eight descendant levels, six fields per fragment, 32-byte string values, and 12 KiB of serialized context. Arbitrary identifiers, Debug/Display values, messages, prompts, tool arguments/results, URLs, and provider payloads are excluded even when OTEL message capture is enabled.
Diagnostic scope
Snapshots are partial operation histories, not causal error chains, effect guarantees, or replay-safety evidence. Upstream TaskManager execution spawns and Compose blocking/worker boundaries do not fully propagate tracing ancestry; remote child spans are not transported into parent logs. Collection and persistence remain best-effort at existing error boundaries.
Hidden-tool wrappers also preserve native interruption and pre-invocation failure outcomes rather than collapsing them through the legacy invocation API.